#include <iostream>
#include <bitset>
using namespace std;

int NumberOf1(int n)
{
    int count = 0;
    while (n)
    {
        ++ count;
        n = (n - 1) & n;
    }
    return count;
}


int Is2Square(int n)
{
    return (n & (n - 1)) == 0;
}

int main(int argc, char * argv[])
{
    int number = -62;
    cout << "bin set: " << bitset<32>(number) << endl;
    cout << "number of 1: " << NumberOf1(number) << endl;

    int number2 = 31;
    cout << "Is 2^n: " << Is2Square(number2) << endl;
    return 0;
}
